package com.qf.gateway.application.filter;

import org.springframework.cloud.gateway.filter.GatewayFilter;
import org.springframework.cloud.gateway.filter.factory.AbstractGatewayFilterFactory;
import org.springframework.stereotype.Component;

/**
 * 局部过滤器
 */
@Component
public class MyJubuFilter extends AbstractGatewayFilterFactory {

    @Override
    public GatewayFilter apply(Object config) {
        return (exchange, chain) -> {
            System.out.println("局部过滤器....");
            return chain.filter(exchange);
        };
    }

    /**
     * 给局部过滤器设置一个名称
     * @return
     */
    @Override
    public String name() {
        return "myfilter";
    }


}
